//
//  AnnouncementCell.m
//  LiveStar
//
//  Created by 漪珊 on 2017/5/18.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "AnnouncementCell.h"
#import "AnnouncementModel.h"

@implementation AnnouncementCell

- (void)awakeFromNib {
    [super awakeFromNib];
    kViewRadius(self.backView, 5);
}

- (void)setAnnouncementModel:(AnnouncementModel *)announcementModel {
    _announcementModel = announcementModel;
    self.msgLabel.text = _announcementModel.b_description;
    self.timeLabel.text = _announcementModel.b_lasttime;
    CGSize maxSize = CGSizeMake(kSCREEN_WIDTH - 30, MAXFLOAT);
    NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14], NSForegroundColorAttributeName: [UIColor colorWithWhite:0.263 alpha:1.000]};
    CGSize textSize = [announcementModel.b_description boundingRectWithSize:maxSize
                                                        options:NSStringDrawingUsesLineFragmentOrigin
                                                     attributes:attributes
                                                        context:nil].size;
    CGSize richTextSize = CGSizeMake(textSize.width, textSize.height + 2);
    self.heightConstraint.constant = richTextSize.height + 10;

}

@end
